package com.hongkuncheng.cms.config;

import com.hongkuncheng.cms.interceptor.OrganizationInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.hongkuncheng.cms.interceptor.FormLoginInterceptor;
import com.hongkuncheng.cms.interceptor.AdminLoginInterceptor;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new FormLoginInterceptor())
                .addPathPatterns("/form/**");
        registry.addInterceptor(new AdminLoginInterceptor())
                .addPathPatterns("/admin/**")
                .excludePathPatterns("/admin/login", "/admin/loginSingle", "/admin/logindo");
        registry.addInterceptor(new OrganizationInterceptor())
                .addPathPatterns("/admin/loginSingle", "/interfaces/organization/**");
    }
}
